package org.springblade.dev;

import cn.hutool.core.collection.ListUtil;
import org.springblade.dev.support.BladeCodeGenerator;

import java.util.List;

/**
 * 保留版权 : CopyRright (c) Armyant
 * 文件名称 : MPCodeGenerator.java
 * 文件编号 : 1-1-1
 * 功能描述 :
 * 文件版本 : 2021.06.23.01
 * 创建人名 : 于继业
 * 创建日期 : 2021-06-23
 * 修改人名 :
 * 修改日期 :
 * https://www.hxstrive.com/subject/mybatis_plus.htm?id=284
 * 【MybatisPlus根据模板生成器代码】https://www.cnblogs.com/chenyanbin/p/13702283.html
 * https://blog.csdn.net/qq_42682745/article/details/120626012
 * https://baomidou.com/pages/779a6e/#%E5%AE%89%E8%A3%85
 * https://blog.csdn.net/leilei1366615/article/details/104661610
 * https://blog.csdn.net/gfl1427097103/article/details/91557579/
 * https://blog.csdn.net/qq_38796327/article/details/99736134
 * https://blog.csdn.net/hkl_Forever/article/details/126614350
 *
 * @author 于继业
 */
public class CodeGenerator {

    /*生成boot文件*/
    private static final boolean IS_BOOT = Boolean.TRUE;
    /** 代码生成的模块名 */
    public static String CODE_NAME = "应用管理";
    /** 服务模块 */
    public static String SERVICE_NAME = "blade-customer";
    /** 代码生成的包名 */
    public static String PACKAGE_NAME = "org.springblade.modules";
    /** 前端代码生成所属系统 */
    public static String SYSTEM_NAME = "saber";
    /** 前端代码生成地址 */
    public static String PACKAGE_WEB_DIR = "F:\\node_project\\crm-ui";
    /** 需要去掉的表前缀 */
    public static String TABLE_PREFIX = "blade_";
    /** 需要生成的表名(两者只能取其一) */
    public static List<String> INCLUDE_TABLES = ListUtil.toList("customer");
    /** 需要排除的表名(两者只能取其一) */
    public static String[] EXCLUDE_TABLES = {};
    /** 是否包含基础业务字段 */
    public static Boolean HAS_SUPER_ENTITY = Boolean.TRUE;
    /**
     * 基础业务字段
     * {"id", "create_time", "create_user", "create_dept", "update_time", "update_user", "status", "is_deleted"}
     */
    public static String[] SUPER_ENTITY_COLUMNS = {};
    /**
     * 项目路径
     * /Users/armyant/Documents/dev_project/test-tool
     * F:\java_project\comics
     */
    public static String PROJECT_PATH = "F:\\java_project\\CRM";

    /** RUN THIS */
    public static void run() throws NoSuchFieldException, IllegalAccessException {
        BladeCodeGenerator generator = new BladeCodeGenerator();
        generator.setServiceName(SERVICE_NAME);
        generator.setPackageName(PACKAGE_NAME);
        generator.setIncludeTables(INCLUDE_TABLES);
        generator.setTablePrefix(TABLE_PREFIX);
        generator.setExcludeTables(EXCLUDE_TABLES);
        generator.setHasSuperEntity(HAS_SUPER_ENTITY);
        generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS);
        generator.setHasWrapper(true);
        generator.setBoot(IS_BOOT);
        generator.setProjectPath(PROJECT_PATH);
        generator.setPackageWebDir(PACKAGE_WEB_DIR);
        generator.run();
    }

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        run();
    }
}
